package domainLogic;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

/**
 * @author  jungmins
 */
public class Bid {
	/**
	 * @uml.property  name="id"
	 */
	private int id;
	private int item_id;
	private String user_id;
	/**
	 * @uml.property  name="price"
	 */
	private int price;
	/**
	 * @uml.property  name="biddate"
	 */
	private Timestamp biddate;
	
	/**
	 * @return
	 * @uml.property  name="id"
	 */
	public int getId() {
		return id;
	}
	/**
	 * @param id
	 * @uml.property  name="id"
	 */
	public void setId(int id) {
		this.id = id;
	}
	public String getUserId() {
		return user_id;
	}
	public void setUserId(String user_id) {
		this.user_id = user_id;
	}
	public int getItemId() {
		return item_id;
	}
	public void setItemId(int item_id) {
		this.item_id = item_id;
	}
	/**
	 * @return
	 * @uml.property  name="price"
	 */
	public int getPrice() {
		return price;
	}
	/**
	 * @param price
	 * @uml.property  name="price"
	 */
	public void setPrice(int price) {
		this.price = price;
	}
	/**
	 * @return
	 * @uml.property  name="biddate"
	 */
	public Timestamp getBiddate() {
		return biddate;
	}
	/**
	 * @param biddate
	 * @uml.property  name="biddate"
	 */
	public void setBiddate(Timestamp biddate) {
		this.biddate = biddate;
	}
	public Bid() {}
	
	public Bid(ResultSet rs) {
		try {
			this.setId(rs.getInt("id"));
			this.setItemId(rs.getInt("item_id"));
			this.setUserId(rs.getString("user_id"));
			this.setPrice((int)rs.getDouble("price"));
			this.setBiddate(rs.getTimestamp("biddate"));
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
}
